package cn.tedu.submarine;

import javax.swing.ImageIcon;

/**
 * 水雷类
 */
public class Mine extends SeaObject{
    public Mine(int x,int y){
        super(11,11,x,y,1);
    }
    @Override
    public void move() {
        //水雷向上移,位置减去速度
        setY(getY()-getSpeed());
    }

    @Override
    public ImageIcon getImage() {
        return Images.mine;
    }

    /**
     * 重写方法，检测水雷是否越界
     * @return
     */
    public boolean isOutOfBounds(){
        //设置水雷的y<=150-水雷的高，即为越界
        return this.getY()<=150-this.getHeight();
    }
}
